package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.StoredValueCardRuleMapper;
import com.ruoyi.system.domain.StoredValueCardRule;
import com.ruoyi.system.service.IStoredValueCardRuleService;

/**
 * 储值卡规则 Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-22
 */
@Service
public class StoredValueCardRuleServiceImpl implements IStoredValueCardRuleService
{
    @Autowired
    private StoredValueCardRuleMapper storedValueCardRuleMapper;

    /**
     * 通过id查询储值卡规则
     *
     * @param id 储值卡规则主键
     * @return 储值卡规则
     */
    @Override
    public StoredValueCardRule selectStoredValueCardRuleById(Long id)
    {
        return storedValueCardRuleMapper.selectStoredValueCardRuleById(id);
    }

    /**
     * 通过门店名称查询储值卡规则列表
     *
     * @param storeName 门店名称
     * @return 储值卡规则
     */
    @Override
    public List<StoredValueCardRule> selectStoredValueCardRuleListByName(String storeName)
    {
        return storedValueCardRuleMapper.selectStoredValueCardRuleListByName(storeName);
    }

    /**
     * 新增储值卡规则
     *
     * @param storedValueCardRule 储值卡规则
     * @return 结果
     */
    @Override
    public int insertStoredValueCardRule(StoredValueCardRule storedValueCardRule)
    {
        storedValueCardRule.setCreateTime(DateUtils.getNowDate());
        return storedValueCardRuleMapper.insertStoredValueCardRule(storedValueCardRule);
    }

    /**
     * 修改储值卡规则
     *
     * @param storedValueCardRule 储值卡规则
     * @return 结果
     */
    @Override
    public int updateStoredValueCardRule(StoredValueCardRule storedValueCardRule)
    {
        storedValueCardRule.setUpdateTime(DateUtils.getNowDate());
        return storedValueCardRuleMapper.updateStoredValueCardRule(storedValueCardRule);
    }

    /**
     * 通过id批量删除储值卡规则信息
     *
     * @param ids 需要删除的储值卡规则主键
     * @return 结果
     */
    @Override
    public int deleteStoredValueCardRuleByIds(Long[] ids)
    {
        return storedValueCardRuleMapper.deleteStoredValueCardRuleByIds(ids);
    }

    /**
     * 通过id删除储值卡规则信息
     *
     * @param id 储值卡规则主键
     * @return 结果
     */
    @Override
    public int deleteStoredValueCardRuleById(Long id)
    {
        return storedValueCardRuleMapper.deleteStoredValueCardRuleById(id);
    }
}
